#ifndef GUI_TASK_H
#define GUI_TASK_H

#include "cooptask.h"
#include "uiservs.h"

/**
GUI background task.
This class manages the GUI module.
*/
class GUITask : public cnc::base::CooperativeTask
{
	cnc::ui::Services *uiServices_;
public:
	GUITask()
	{
	}
	virtual void start()
	{
		uiServices_->start();
/*		vksrv_->start();
		vksrv_->setState(cnc::comm::CYCLE::ID, cnc::comm::CYCLE::FEED_HOLD);
		vksrv_->setState(cnc::comm::MODE::ID, cnc::comm::MODE::HOME);
		vksrv_->setState(cnc::comm::OPTION::ID, cnc::comm::OPTION::SINGLE_BLOCK_OFF);
		vksrv_->setState(cnc::comm::FEEDRATE_OVERRIDE::ID, 100);
		vksrv_->setState(cnc::comm::JOG_FEEDRATE::ID, 1000);
		vksrv_->setState(cnc::comm::RAPID_FEEDRATE_OVERRIDE::ID, 100);
		vksrv_->setState(cnc::comm::SPINDLE::ID, cnc::comm::SPINDLE::NORMAL_ROTATION);
		vksrv_->setState(cnc::comm::SPINDLE::ID, cnc::comm::SPINDLE::STOP);
		vksrv_->setState(cnc::comm::SPINDLE_SPEED::ID, 100);
		vksrv_->setState(cnc::comm::SPINDLE_OVERRIDE::ID, 100);
		vksrv_->setState(cnc::comm::HANDWHEEL::ID, cnc::comm::HANDWHEEL::FACTOR_1);
		vksrv_->setState(cnc::comm::HANDWHEEL::ID, cnc::comm::HANDWHEEL::SELECT_AXIS_X);
		vksrv_->setState(cnc::comm::TOOL::ID, 2);*/
	}
	virtual bool execute()
	{
		uiServices_->execute();
//		return srv_->execute() && vksrv_->execute();
		return true;
	}
	virtual void stop()
	{
		uiServices_->stop();
//		vksrv_->stop();
	}
	void setUIServices(cnc::ui::Services *uiServices)
	{
		uiServices_ = uiServices;
	}
};

#endif
